import instance from "./request";

export async function obtainBookCover(bookId) {
  return await instance.get(`/book/${bookId}/cover`).data;
}

export async function obtainBookCoverURL(bookId) {
  const response = await instance.get(`/book/${bookId}/cover`);
  let url = response.data;
  if (url.startsWith("http")) return url;
  else return await obtainBookCover(bookId).data;
}
